﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace PDX
{
    public static class Scope
    {
        public static void Raise(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            var raiser = sender as IRaiseDependencyPropertyChanges;
            if (raiser != null)
            {
                raiser.Raise(args);
            }
        }



        public static object GetNotificationScope(DependencyObject obj)
        {
            return (object)obj.GetValue(NotificationScopeProperty);
        }

        public static void SetNotificationScope(DependencyObject obj, object value)
        {
            obj.SetValue(NotificationScopeProperty, value);
        }

        // Using a DependencyProperty as the backing store for NotificationScope.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty NotificationScopeProperty =
            DependencyProperty.RegisterAttached("NotificationScope", typeof(object), typeof(Scope),
            new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits,
                new PropertyChangedCallback(Raise)));



        public static object GetChangeTrackingScope(DependencyObject obj)
        {
            return (object)obj.GetValue(ChangeTrackingScopeProperty);
        }

        public static void SetChangeTrackingScope(DependencyObject obj, object value)
        {
            obj.SetValue(ChangeTrackingScopeProperty, value);
        }

        // Using a DependencyProperty as the backing store for ChangeTrackingScope.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty ChangeTrackingScopeProperty =
            DependencyProperty.RegisterAttached("ChangeTrackingScope", typeof(object), typeof(Scope),
            new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits,
                new PropertyChangedCallback(Raise)));

    }
}
